<?php

/* *
 * 资讯
 */
namespace Common\Model;
use Think\Model;
class RxModel extends BaseModel {

    public function queryForList($page=null, $map=null) {
        $list = $this->alias("rx")
            ->join("left join __EMPLOYEE__ emp on emp.employee_id = rx.update_id")
//            ->join("left join __PRODUCT__ p on p.product_id = wo.product_id")
//            ->join("left join __PAY__ pay on pay.pay_id = wo.pay_id")
            ->where(getWhereSqlByMap($map))
            ->order("rx.create_time desc")
            ->limit($page->firstRow . ',' . $page->listRows)
//            ->field("wo.*,cus.nickname,p.product_name,cus.doctor_name,cus.hospital_name,pay.out_trade_no")
            ->field("rx.*, emp.employee_name")
            ->select();

        return $list;

    }

    public function getListCount($map = null) {

        $count = $this->alias("rx")
//            ->join("left join __PRODUCT__ p on p.product_id = wo.product_id")
//            ->join("left join __CUSTOMER__ cus on cus.customer_id = wo.customer_id")
            ->where(getWhereSqlByMap($map))
            ->count();

        return $count;
    }

}

